#include <stdio.h>

/*
	Extend atof to handle scientific notation of the form 123.45e-6 where a floating-point number may be followed by e or E 
		and an optionally signed exponent.
*/
int main(){
	float  atof(char []);
	char s[] = " +12.1ss";
	float result = atof(s);
	printf("%f\n", result);
	return 0;
}

float atof(char s[]){
	float result = 0 ;
	int power = 1, i, sign = 0;
	for(i = 0; s[i] != '\0'; i++){
		if(s[i] == ' '){
			continue;
		}
		if(s[i] == '+' || s[i] == '-'){
			continue;
		}
		if((sign - 1) && s[i] >= '0' && s[i] <= '9'){
			result = 10.0*result + s[i] - '0';
		}
		if(s[i] == '.'){
			sign = 1;
			continue;
		}
		if( sign && s[i] >= '0' && s[i] <= '9' ){
			result  = result*10.0 + s[i] - '0';
			power *= 10;
			
		}
		if(){
			
		}
	}
	return result / power;
	
}
